package com.example.app;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

public class WebpageActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.web_page);
        Button button = findViewById(R.id.web_go_back);
        button.setOnClickListener(view -> finish()); // 添加返回按钮
        Intent intent = getIntent();
        String name = intent.getStringExtra("name");
        String url = intent.getStringExtra("url");

        TextView textView = findViewById(R.id.web_title);
        textView.setText(name);

        WebView webView = findViewById(R.id.web_content);
        webView.setWebViewClient(new WebViewClient());
        webView.loadUrl(url);
    }
}
